
/**
 * 提示框 
 * @param {Object} str
 * @param {Object} callback
 */
function showTips(str, callback) {
	
	safeRemoveBox();
	
	var $dom = $('<div class="tips-box" id="tipsBox">\
				   <div class="tips-wrapper">\
						<div class="tips-item clearfix">\
							<span class="tip-img"></span>\
							<span class="tip-info"></span>\
						</div>\
						<div class="tips-confirm">\
							<a href="javascript:void(0)" class="tips-btn ___closeBox">确定</a>\
						</div>\
					</div>\
				</div>');
	
	$dom.find('.tip-info').html(str);
	
	$.XYTipsWindow({
		___title:"中奖提示框",
		___content:"text:" + $dom.html(),
		___showbg:true,
		___drag:"___boxTitle",
		___width:"400px",
		___height:"200px",
		___boxWrapBdColor:"#666",
		___boxBdColor:"#a5a5a5",
		___fnClose:function(){
			//关闭窗口后执行的函数
			if (typeof callback === 'function') {
				callback();
			}
		}
	});
	
}

//返回顶部
$(function () {
	$("#backToTop").click(function() {
	    $("html,body").animate({scrollTop: 0}, 0);
	    return false;
	});
});

//检查字符数目
function getStrWithLength(str, num) {
	var count = 0,
		resStr = '',
		tempChar;
	
	for (var i = 0; i < str.length; i++) {
		tempChar = str.charAt(i);
		if (/^[\u0391-\uFFE5]+$/.test(tempChar)) {
			count += 2;
			if (count > num) {
				return resStr;
			}
		} else {
			count++;
		}
		resStr += tempChar;
	}
	return resStr;
}

